/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pkg23designpatterns.za.ac.cput.structural.adapter;

/**
 *
 * @author Oceanwave
 */
public class TemperatureObjectReporter implements TemperatureInfo 
{
    
    CelciusReporter celciusReporter;
    
    public TemperatureObjectReporter()
    {
        celciusReporter = new CelciusReporter();
    }

    @Override
    public double getTemperatureInF() 
    {
        return cTOF(celciusReporter.getTemperature());
    }

    @Override
    public void setTemperatureInF(double temperatureInF) 
    {
        celciusReporter.setTemperature(fTOC(temperatureInF));
    }

    @Override
    public double getTemperatureInC() 
    {
        return celciusReporter.getTemperature();
    }

    @Override
    public void setTemperatureInC(double temperatureInC) {
        celciusReporter.setTemperature(temperatureInC);
    }

    private double fTOC (double f)
    {
        return ((f-32) * 5 / 9);
    }
    
    private double cTOF (double c)
    {
        return ((c * 9 / 5) + 32);
    }
    
}
